// pages/serviceList/serviceList.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    pages: 1,
    dataList: []
  },
  seeDetails: function (e) {
    if (e.currentTarget.dataset.flags==1){
      wx.navigateTo({
        url: 'serviceDetails?id=' + e.currentTarget.dataset.ids
      })
    }
  },
  onReachBottom: function () {
    this.getData()
  },
  onLoad: function (options) {
    this.getData()
  },
  getData: function () {
    let _this = this;
    wx.showLoading({
      title: '玩命加载中',
    })
    wx.request({
      url: getApp().data.servsers + '/membership/listByUserId',
      header: {
        'content-type': 'application/json'
      },
      data: {
        startPage: _this.data.pages,
        PageSize: 10,
        userId: getApp().data.userId
      },
      success(res) {
        let data = res.data;
        if (data.status == 'success') {
          wx.hideLoading();
          if (_this.data.dataList.length < res.data.data.total) {
            _this.setData({
              dataList: _this.data.dataList.concat(data.data.list)
            })
            _this.setData({
              pages: _this.data.pages += 1
            })
          }
        }
      }
    })
  }
})